//**********************************************************************
// Test2.java        Author: 20172330              
// 修改11-1,使得当异常抛出时捕获他并且处理。
//**********************************************************************

import java.util.Scanner;

public class Test2 {
    public static void main(String[] args){
        final int Num = 20;

        Scanner scan = new Scanner(System.in);

        StringTooLongException problem = new StringTooLongException("You input the too long words");

        System.out.println("Please enter some words:" );
        String string = scan.nextLine();

        try {
            if (string.length() > Num)
            throw problem;
        }
        catch (StringTooLongException exception)
        {
            System.out.println("You input too long words.");
        }


        if(string.substring (string.length() - 4, string.length()).equals("DONE" ))
            System.out.println("End of the thing.");


    }
}
